﻿using Haidou.Wpf.Native.Structs;
using Haidou.Wpf.UI.ViewModel;
using Haidou.Wpf.Util;

namespace Haidou.Wpf.UI.Util
{
	/// <summary>
	/// 保存有关正在运行的实例的当前参数的信息。
	/// </summary>
	public static class Global
	{



		public static MainWindow MainWindow { get; set; }

		public static bool BluetoothPairingState = false;





		/// <summary>
		/// 初始化是通过系统启动
		/// </summary>
		public static int MainWindowInit = 0;


		/// <summary>
		/// 等待完成再继续
		/// </summary>
		public static bool Bw_RunWorkerCompleted = true;





		/// <summary>
		///  低电量 不再提醒
		/// </summary>
		public static bool Notreminding = false;


		/// <summary>
		///   悬浮 精灵--是否离开控件
		/// </summary>
		public static bool Doyouwanttoleavethecontrol = false;

		/// <summary>
		/// 悬浮 精灵
		/// </summary>
		public static PointW FloatingMenuPointW;


		/// <summary>
		/// 启动了应用,启动时间
		/// </summary>
		public static DateTime StartupDateTime { get; set; }

		/// <summary>
		/// 当它为真时，全局快捷键方式不起作用。
		/// </summary>
		public static bool IgnoreHotKeys { get; set; }

		/// <summary>
		/// 如果为真，则安装带有该错误的修补程序。
		/// 
		/// </summary>
		public static bool IsHotFix4055002Installed { get; set; }

		/// <summary>
		/// 当它为真时，应用程序当前正在删除旧项目。
		/// </summary>
		public static bool IsCurrentlyDeletingFiles { get; set; }

		/// <summary>
		/// 当前保存数据的磁盘上的可用空间，以百分比表示。
		/// </summary>
		public static double AvailableDiskSpacePercentage { get; set; }

		/// <summary>
		/// 当前保存数据的磁盘上的可用空间。
		/// </summary>
		public static double AvailableDiskSpace { get; set; }

		/// <summary>
		/// 保存最新可用更新的详细信息。
		/// </summary>
		public static UpdateAvailable UpdateAvailable { get; set; }

		public static System.Windows. Application Current { get; set; }

		/// <summary>
		/// 详情
		/// </summary>
		public static string SystemTypeDetails { get; set; }



		/// <summary>
		///记录快捷键的组合值
		/// </summary>
		public static string Valueofkey { get; set; }




		/// <summary>
		/// 截图翻译前的文本
		/// </summary>
		public static string TranslateTextfront { get; set; }



		/// <summary>
		/// 截图翻译后的文本
		/// </summary>
		public static string TranslateText { get; set; }

		/// <summary>
		/// 翻译模式   ：   0 划词翻译   1 截屏翻译
		/// </summary>
		public static int TranslationType = -1;
		/// <summary>
		/// 语音翻译的文本
		/// </summary>
		public static string TranslateTextContent { get; set; }
		/// <summary>
		/// 需要翻译的语种
		/// </summary>
		public static string ScreenTranslateFrom { get; set; }
		/// <summary>
		/// 需要翻译成的语种
		/// </summary>
		public static string ScreenTranslationTo { get; set; }
		/// <summary>
		/// 需要翻译的语种
		/// </summary>
		public static string ScribeTranslateFrom { get; set; }
		/// <summary>
		/// 需要翻译成的语种
		/// </summary>
		public static string ScribeTranslationTo { get; set; }




		/// <summary>
		/// 按键耗时  用于防止快速重复按下，  毫秒 ms
		/// </summary>
		public static long TimeConsumingStatisticsCount = 0;

		public static long TimeConsumingStatisticsCount1 = 0;





		public static string NavigateURL { get; set; }


		public static string NavigateHomeURL { get; set; }


		/// <summary>
		/// 麦克风可用状态
		/// </summary>
		public static bool MicrophoneAvailabilityStatus = false;



		/// <summary>
		/// 失败次数 语音搜索
		/// </summary>
		public static int Numberoffailures = 0;



		/// <summary>
		/// 当前是否可用PC 电脑序列号 用户  
		/// </summary>
		public static bool Verification = false;


		/// <summary>
		/// 当前是否可用PC 电脑序列号 用户  
		/// </summary>
		public static string VerificationStatus = "0";





		/// <summary>
		/// PC的时候，保存了 按下的键对应的ai界面值
		/// </summary>
		public static string PCextendedValue { get; set; }


		/// <summary>
		/// PC的时候， 要打开头部Tab选项卡那个功能
		/// </summary>
		public static string PCextendedHeaderTabValue { get; set; }


		/// <summary>


		/// <summary>
		/// 返回时间戳
		/// </summary>
		/// <returns></returns>
		public static long GetTimeLikeJS()
		{
			DateTime lLeft = new(1970, 1, 1);
			DateTime dt = DateTime.Now;
			long Sticks = (long)(dt.ToUniversalTime() - lLeft).TotalMilliseconds;
			return Sticks;
		}


		/// <summary>
		/// 启动 
		/// </summary>
		public static void StartNavigate()
		{

			try
			{


				Utils.UIBeginInvoke(() =>
				{

					

				});
				App_Startup.DisplayUIApp();
			}
			catch (Exception ex)
			{

				LogWriter.Log(" StartNavigate", ex.Message);
			}



		}

		/// <summary>
		/// 
		/// </summary>
		public static void StartNavigateNoTop()
		{

			try
			{


				Utils.UIBeginInvoke(() =>
				{

				});
			}
			catch (Exception ex)
			{

				LogWriter.Log(" StartNavigate", ex.Message);
			}




		}
		/// <summary>
		/// 关闭 
		/// </summary>
		/// <returns></returns>
		public static bool CloseAINavigate()
		{


			try
			{

				IntPtr ptr = App_Startup.HasWindows("");

				int res = Win32.PostMessage(ptr, 0x10, 0, 0);

				return false;

			}
			catch (Exception)
			{
				return false;

			}
		}





	
	


	
		
	}
}
